<%--
  Created by IntelliJ IDEA.
  User: dingruichao
  Date: 2019/5/8
  Time: 6:19 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title></title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
    <script type="text/javascript" src="static/js/util.js"></script>
  </head>
  <body>
  <div id="userinfo">
    当前用户:
  </div>
<br>


  <script type="text/javascript">

    $(document).ready(function(e) {

      if(!getCookie("jwt_token")){
        window.location = "login.html";
      }else{
        $("#userinfo").text("当前登录用户:"+getCookie("username"));
      }

      $("#biz1").click(function(){
        window.location = "datatable.html";
      });
      $("#getBtn").click(function(){

        var biz = $("#biz").val();
//        alert(biz);


        $.ajax({     //Json数据

          url:getHttpdomain()+"/"+biz,//传输到哪个页面处理
          type:"GET",//传输方式
          dataType:"TEXT",//返回类型 字符串

          headers: {
                  "Token":getCookie("jwt_token"),
                  'username':getCookie("username")
           },
          success: function(data){ //执行成功之后执行的方法  又称为回调函数
//            alert(data);


            $("#retdata").val(data);
          }

        });


      })


    });






  </script>


  <div><input type="button" value="进入业务管理1" id="biz1"/></div><br />
<br>

  测试rest请求业务<br>
  <div>
  <div>业务<input type="text" size="60" id="biz" /></div><br />
  <div>返回信息:<textarea id="retdata"   cols="40"   rows="4"   style="OVERFLOW:   hidden"></textarea></div><br  />
  <div><input type="button" value="获取" id="getBtn"/></div><br />
</div>

  </body>
</html>
